package cn.caipengbo.action;


import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by Myth on 3/1/2017.
 */
//这是一个 controller
public class Hello implements Controller {

    @Override
    public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
        ModelAndView modelAndView = new ModelAndView();

        //向页面显示一行提示信息
        //下边的方法就相当于request.setAttribute(arg0, arg1)
        modelAndView.addObject("message", "没使用url映射!!!!!!");

        //指定jsp页面地址,完整的路径
        // modelAndView.setViewName("/pages/view.jsp");
        //指定逻辑视图名，真正的视图地址：前缀+逻辑视图名+后缀
        modelAndView.setViewName("view");

        return modelAndView;
    }
}
